function callConnect(response) {
	$("#textDiv").append('<br/>'+response);
	connect();
};

function connect() {
	client_input_id = $("input#client_id").val();
	$.post('http://localhost/longpolling/spush/server/php/spush.php', { request_type: "connect", client_id: client_input_id }, callConnect, 'json');
};

$(document).ready( function() {
	// Long polling
	$("#textDiv").empty();
	$("#textDiv").append("EN ATTENTE D'UN EVENEMENT");
	// On se connecte au serveur si clic sur le bouton
	$("#log_button").click( function() {
		connect();
		$("#textDiv").append("<br/>CONNEXION ...");
	});
});